#ifndef DOWNLOADWIDGET_H
#define DOWNLOADWIDGET_H

#include <QWidget>
#include <QFrame>
#include <QWebEngineDOwnloadRequest>
#include <QTime>
#include <QFileInfo>
#include <QDesktopServices>

namespace Ui {
class DownloadWidget;
}

class DownloadWidget : public QFrame
{
    Q_OBJECT

public:
    explicit DownloadWidget(QWebEngineDownloadRequest *download, QWidget *parent = nullptr);
    ~DownloadWidget();

signals:
    void removeClicked(DownloadWidget *self);

public:
    // 更新下载进度等
    void updateWidget();

private slots:
    void on_pushButton_clicked();

private:
    QString withUnit(qreal bytes);
    QWebEngineDownloadRequest *m_download;
    QTime m_timeAdded;
    Ui::DownloadWidget *ui;
};

#endif // DOWNLOADWIDGET_H
